﻿<UserControl x:Class="BizControl.Presentation.PersonMarksModule.Views.PersonMarksView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:cmdsext="clr-namespace:BizControl.Presentation.Infrastructure.Helpers;assembly=BizControl.Presentation.Infrastructure"
             x:Name="PersonMarksControl">
    
    <UserControl.Resources>
        <DataTemplate x:Key="MarksInfoBriefSetTemplate">
            <Button Width="100" MaxHeight="90" Style="{StaticResource AnimatedItemButton}"
                    Command="{Binding ElementName=PersonMarksControl, Path=DataContext.EditPersonMarkCommand}"
                    CommandParameter="{Binding Path=Id}">
                <Border Background="{StaticResource CompletedBrush}" MaxHeight="90" 
                        BorderBrush="Black" BorderThickness="1" CornerRadius="4" Margin="2">
                    <Border.ToolTip>
                        <TextBlock Grid.Column="1" Text="{Binding Path=Name}" TextWrapping="Wrap" Margin="5" VerticalAlignment="Center" />
                    </Border.ToolTip>
                    <TextBlock Text="{Binding Path=Name}" Margin="2" FontSize="8pt" FontWeight="Bold" 
                           HorizontalAlignment="Left" VerticalAlignment="Top"
                           TextWrapping="Wrap" Foreground="Blue" />
                </Border>
            </Button>
        </DataTemplate>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <ToolBar>
            <Button HorizontalAlignment="Left" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
                    Width="25" Height="25" ToolTip="Обновить список"
                    Command="{Binding Path=RefreshListCommand}">
                <Button.Content>
                    <Image Source="{DynamicResource refreshImage}" />
                </Button.Content>
            </Button>
            <Button HorizontalAlignment="Left" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
                    Width="25" Height="25" ToolTip="Добавить навык"
                    Command="{Binding Path=AddPersonMarkCommand}"
                    Template="{StaticResource AddButtonTemplate}">
            </Button>
        </ToolBar>
        <ItemsControl Grid.Row="2" Background="{x:Null}" ItemsSource="{Binding Path=Model, Mode=OneWay}" 
                      ItemTemplate="{StaticResource MarksInfoBriefSetTemplate}" HorizontalContentAlignment="Stretch">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>

        <!--<DataGrid Grid.Row="2" AutoGenerateColumns="False" ItemsSource="{Binding Path=Model, Mode=OneWay}"
                  cmdsext:Commands.DataGridDoubleClickCommand="{Binding EditPersonMarkCommand}">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=Name, Mode=OneWay}" Header="Наименование" />
            </DataGrid.Columns>
        </DataGrid>-->
    </Grid>
</UserControl>
